package net.googlecode.demenkov.task3;

import java.math.BigDecimal;

/**
 * Salary test. Creates employees and counts them salary.
 *
 * @author Yura Demenkov
 */
public class SalaryApp {
    /**
     * Counts employees salary.
     *
     * @param args
     */
    public static void main(String[] args) {
        SalaryApp app = new SalaryApp();

        SalaryCalculator cal = new SalaryCalculator();

        cal.calcSalary(createManagerWithoutBonus());
        cal.calcSalary(createManagerWithBonus());
        cal.calcSalary(createEmployeeWithBonus());
        cal.calcSalary(createEmployeeWithoutBonus());
        cal.calcSalary(createBoss());
    }

    /**
     * Creates manager without bonus.
     *
     * @return Manager
     */
    public static Manager createManagerWithoutBonus() {
        Manager manager = new Manager("Ivan", "Ivanov");
        manager.setAge(30);
        manager.setPerHour(true);
        manager.setBonus(false);
        manager.setRate(new BigDecimal(25));

        return manager;
    }

    /**
     * Creates manager with bonus.
     *
     * @return Manager
     */
    public static Manager createManagerWithBonus() {
        Manager manager = new Manager("Petr", "Petrov");
        manager.setAge(35);
        manager.setBonus(true);
        manager.setBonusAmount(new BigDecimal(1000));
        manager.setPerHour(false);
        manager.setRate(new BigDecimal(5000));

        return manager;
    }

    /**
     * Creates Employee with bonus.
     *
     * @return Employee
     */
    public static Employee createEmployeeWithBonus() {
        Employee employee = new Employee("Semen", "Semenov");
        employee.setAge(55);
        employee.setBonus(true);
        employee.setBonusAmount(new BigDecimal(1500));
        employee.setPerHour(true);
        employee.setRate(new BigDecimal(8));

        return employee;
    }

    /**
     * Creates Employee without bonus.
     *
     * @return Employee
     */
    public static Employee createEmployeeWithoutBonus() {
        Employee employee = new Employee("Sergey", "Sergeev");
        employee.setAge(45);
        employee.setBonus(false);
        employee.setPerHour(false);
        employee.setExperience(15);
        employee.setRate(new BigDecimal(200));

        return employee;
    }

    /**
     * Creates Boss.
     *
     * @return Boss
     */
    public static Boss createBoss() {
        Boss boss = new Boss("Pankrat", "Pankratovich");
        boss.setAge(55);
        boss.setRate(new BigDecimal(35));
        boss.setBonusAmount(new BigDecimal(2000));
        return boss;
    }
}
